package com.yuhs.zixing.study.design.pattern.dp002.structural.s004.composite.c003;

import java.util.ArrayList;

/**
 * @description:
 * @author: yuhs
 * @date: 2022/5/1 10:09 PM
 */
public class Branch003 extends Corp003 {
    //领导下边有哪些下级领导和小兵
    ArrayList<Corp003> subordinateList = new ArrayList<Corp003>();

    //构造函数是必需的
    public Branch003(String _name, String _position, int _salary) {
        super(_name, _position, _salary);
    }

    //增加一个下属，可能是小头目，也可能是个小兵
    public void addSubordinate(Corp003 corp) {
        this.subordinateList.add(corp);
    }

    //我有哪些下属
    public ArrayList<Corp003> getSubordinate() {
        return this.subordinateList;
    }
}